<template>
    <!-- 运输管理措施 -->
    <div>
        <div class="basicCell">
            <div class="basicCellTitle">附件上传</div>
            <el-form ref="formBasic" :rules="rulesBasic" label-width="150px">
                <el-row>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/sqb.png" />
                            </div>
                            <div class="fileInforTitle">申请表</div>
                            <div class="fileInforSubtitle">请上传盖章后的建筑垃圾处置申请表</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/pdf.png" />
                            </div>
                            <div class="fileInforTitle">处理方案</div>
                            <div class="fileInforSubtitle">请上传盖章后的建筑垃圾处理方案</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/zj.png" />
                            </div>
                            <div class="fileInforTitle">相关证件</div>
                            <div class="fileInforSubtitle">请上传身份证、委托人相关等相关证件</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/sqb.png" />
                            </div>
                            <div class="fileInforTitle">运输单位意向书</div>
                            <div class="fileInforSubtitle">请上传盖章后的建筑垃圾处置申请表</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/sqb.png" />
                            </div>
                            <div class="fileInforTitle">处置单位委托意向书</div>
                            <div class="fileInforSubtitle">请上传盖章后的建筑垃圾处置申请表</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="fileInfor">
                            <div class="fileInforImg">
                                <img src="@/assets/images/beian/sqb.png" />
                            </div>
                            <div class="fileInforTitle">相关材料</div>
                            <div class="fileInforSubtitle">请上传其他相关材料信息</div>
                            <div class="fileInforUpload">
                                <el-button type="primary" @click="uploadSQB()">上传文件</el-button>
                            </div>
                            <div class="fileInforList"> </div>
                        </div>
                    </el-col>
                </el-row>
            </el-form>
            <el-dialog :title="titleFiles" :visible.sync="openFile" width="500px" append-to-body>
                <el-form ref="formBasic" :rules="rulesFile" label-width="100px">
                    <div class="basicSubtitle">文件信息</div>
                    <el-row>
                        <el-col :span="24">
                        <el-form-item label="文件名称" prop="name">
                            <el-select class="fillUp" v-model="formFile.name" clearable placeholder="请选择文件名称">
                                <el-option v-for="(v,index) in nameFileList" :key="index" :label="v.label" :value="v.value" ></el-option>
                            </el-select>
                        </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="文件类型" prop="type">
                            <el-select class="fillUp" v-model="formFile.type" clearable placeholder="请选择文件名称">
                                <el-option v-for="(v,index) in fileTypeList" :key="index" :label="v.label" :value="v.value" ></el-option>
                            </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="文件上传" prop="fileUrl">
                                <FileUpload v-model="formFile.fileUrl" :limit="1" :fileSize="10" />
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="submitFile">确 定</el-button>
                </div>
            </el-dialog>
        </div>
        <div class="baAddRightBtm">
            <el-button type="primary" @click="next">暂存</el-button>
            <el-button type="primary" v-if="stepActive != 0" @click="back">上一步</el-button>
            <el-button type="primary" v-if="stepActive < 3" @click="next">下一步</el-button>
            <el-button type="primary" v-if="stepActive == 3" @click="next">确认</el-button>
        </div>
    </div>
  </template>
  
  <script>
  export default {
    name: "Record",
    components: {  },
    data() {
      return {
        stepActive: 0, // 进度
        formData: { // 表单数据
            tableDataTrans: []
        }, 
        rulesBasic: null, // 校验
        typeList: [],

        // 文件上传
        fileTypeList: [
            { label: '文件', value: '1' },
            { label: '图片', value: '2' }
        ],
        nameFileList: [
            { label: '申请表', value: '1' },
            { label: '建筑垃圾处理方案', value: '2' },
            { label: '相关证件', value: '3' },
            { label: '运输单位委托意向书', value: '4' },
            { label: '处置单位委托意向书', value: '5' },
            { label: '相关材料', value: '6' },
        ],
        titleFiles: "上传文件",
        openFile: false, // 弹窗显示隐藏
        formFile: {
            name: '', // 文件名称
            type: null, // 文件类型
            fileUrl: null, // 上传地址
        },
        rulesFile: [],

      };
    },
    created() {
    },
    methods: {
        next(){
            this.$emit("next")
        },
        back(){
            this.$emit("back")
        },
        
        // 文件上传 =========================
        uploadSQB(){
            this.openFile = true
        },
        submitFile(){
            this.openFile = false
        }
    }
  };
  </script>
  
  <style scoped lang="scss" >
    .app-container{
       .baAdd{
        display: flex;
        .baAddLeft{
            width: 200px;
            max-height: 350px;
        }
        .baAddRight{
            width: calc(100% - 200px);
            font-size: 14px;
            font-weight: 500;
            line-height: 20px;
            letter-spacing: 0px;

            .baAddRightBasic{
                padding-bottom: 60px;
                .basicCellTitle{
                    font-size: 24px;
                    font-weight: bold;
                    line-height: 32px;
                    padding: 10px 0;
                }
                .basicSubtitle{
                    font-size: 18px;
                    font-weight: 600;
                    line-height: 28px;
                    letter-spacing: 0px;
                    padding: 10px 0;
                }
                .basicFence{
                    width: 100%;
                    min-height: 300px;
                    border: 1px solid;
                    border-radius: 5px;
                }
            }

            .el-select{
                width: 100%;
            }
            .baAddRightBtm{
                position: fixed;
                bottom: 0;
                width: 100%;
                width: calc(100% - 230px);
                text-align: center;
                height: 50px;
                background-color: white;
                padding-top: 10px;
                box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.5);
            }
        }
       } 
    }
  </style>